From: Ian Campbell Date: Thu, 26 May 2011 07:18:44 +0000 (+0100) Subject: IOMMU: Fail if intremap is not available and iommu=required/force. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~10295 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=e2fee12d8d0528dc72b065030ae8f346cf07e3e7;p=xen.git IOMMU: Fail if intremap is not available and iommu=required/force. Rather than sprinkling panic()s throughout the setup code hoist the check up into common code. Signed-off-by: Ian Campbell Signed-off-by: Keir Fraser Acked-by: Ian Jackson --- diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index c5716bd312..0a9965d408 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -311,6 +311,7 @@ int deassign_device(struct domain *d, u8 bus, u8 devfn) int __init iommu_setup(void) { int rc = -ENODEV; + bool_t force_intremap = force_iommu && iommu_intremap; if ( iommu_dom0_strict ) iommu_passthrough = 0; @@ -321,8 +322,10 @@ int __init iommu_setup(void) iommu_enabled = (rc == 0); } - if ( force_iommu && !iommu_enabled ) - panic("IOMMU setup failed, crash Xen for security purpose!\n"); + if ( (force_iommu && !iommu_enabled) || + (force_intremap && !iommu_intremap) ) + panic("Couldn't enable %s and iommu=required/force\n", + !iommu_enabled ? "IOMMU" : "Interrupt Remapping"); if ( !iommu_enabled ) { diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index cbeec5ce0b..79ab4c2042 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1971,8 +1971,6 @@ static int init_vtd_hw(void) "ioapic_to_iommu: ioapic 0x%x (id: 0x%x) is NULL! " "Will not try to enable Interrupt Remapping.\n", apic, IO_APIC_ID(apic)); - if ( force_iommu ) - panic("intremap remapping failed to enable with iommu=required/force in grub\n"); break; } } @@ -1984,11 +1982,10 @@ static int init_vtd_hw(void) iommu = drhd->iommu; if ( enable_intremap(iommu, 0) != 0 ) { + iommu_intremap = 0; dprintk(XENLOG_WARNING VTDPREFIX, "Interrupt Remapping not enabled\n"); - if ( force_iommu && platform_supports_intremap() ) - panic("intremap remapping failed to enable with iommu=required/force in grub\n"); break; } }